package com.nuit.cxl.bilibili;

import com.nuit.cxl.bilibili.dao.RecommendDao;
import com.nuit.cxl.bilibili.service.RecommendService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.sql.DataSource;

@SpringBootApplication
public class BilibiliApplication {
    public static void main(String[] args) {

        SpringApplication.run(BilibiliApplication.class, args);

        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        RecommendService recommendService = (RecommendService) ctx.getBean("recommendService");
        String[] strs = recommendService.fetchRecommend();
        for(String s : strs){
            System.out.println(s);
        }

        DataSource dataSource = (DataSource) ctx.getBean("dataSource");
        System.out.println(dataSource);

    }

}
